<div class="" ng-controller="updateVatCtrl">
  <div class="col-lg-10 col-md-12 col-sm-12">
    <form ng-submit="addRecord()" id="vatForm">
    <table class="table table-bordered table-hover" id="vatInfoTable" class="importVatTable">
        <thead>
          <tr>
            <th class="tableTitle" colspan="11">增值税发票</th>
          </tr>
          <tr>
            <th colspan="2">
              发票号码：
            </th>
            <th colspan="4">
              <input ng-model="vat.vatNumber" style="background: #f5f5f5;" type="text" name="vatNumber" required placeholder="填写发票代码">
            </th>
            <th colspan="2" >
              开票日期：
            </th>
            <th colspan="3" style="padding:0px 8px;vertical-align: middle;">
              <input ng-model="vat.vatDate" style="background: #f5f5f5;" name="vatDate" required placeholder="选择发票日期" class="form-control date-picker" id="id-date-picker-1" type="text" data-date-format="yyyy-mm-dd">
            </th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td style="width:16px;" rowspan="4">购买方</td>
            <td>名称：</td>
            <td colspan="9">
              <div>
                <div style="width:70%;float:left">
                  <input ng-model="vat.outCompany.companyName" type="text" placeholder="填写购买方名称" required name="in.companyName">
                </div>
                <div style="width:30%;float:left">
                  <select style="padding:0px 12px" ng-model="selectIn" autocomplete="off">
                    <option value="" disabled="true" selected="selected">选择已有购买方信息</option>
                    <option ng-repeat="x in clients" value="{{x.companyId}}">{{x.companyName}}</option>
                    <option value="clear">清除选择</option>
                  </select>
                </div>
                <div class="clear"></div>
              </div>
            </td>
          </tr>
          <tr>
            <td style="min-width:172px">纳税人识别号：</td>
            <td colspan="10"><input type="text"  ng-model="vat.outCompany.companyNumber"  name="in.companyNumber" placeholder="填写购买方的纳税识别号"></td>
          </tr>
          <tr>
            <td>地址、电话：</td>
            <td colspan="5">
              <input type="text" ng-model="vat.outCompany.companyAddress"  placeholder="填写购买方的地址" name="in.companyAddress">
            </td>
            <td colspan="5">
              <input type="text" ng-model="vat.outCompany.companyPhone" placeholder="填写购买方的电话" name="in.companyPhone">
            </td>
          </tr>
          <tr>
            <td>开户行及账号</td>
            <td colspan="5">
              <input type="text" ng-model="vat.outCompany.companyAccount"  name="in.companyAccount" placeholder="填写银行账号">
            </td>
            <td colspan="5">
              <input type="text" ng-model="vat.outCompany.bank"  name="in.companyBank" placeholder="填写开户银行">
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <a ng-click="addRow()" class="btn btn-default btn-xs shiny icon-only"><i class="fa fa-plus"></i></a>
              货物或应税劳务、服务名称
            </td>
            <td>大商品类别</td>
            <td>小商品类别</td>
            <td>规格型号</td>
            <td>单位</td>
            <td>数量</td>
            <td>单价</td>
            <td>金额</td>
            <td>税率</td>
            <td>税额</td>
          </tr>
          <tr class="addList" ng-repeat = "x in vat.listData">
            <td  colspan="2">
              <input type="text" name="commodityName" ng-model="x.commodityName"></td>
            <td>
              <!-- <select required ng-model="x.largeClass" ng-options="y.largeClassName for y in x.largeClass" ng-change="lcSelChange($index)">
              </select> -->
              <select required ng-model="vat.listData[$index].lcSel" ng-options="y.largeClassName for y in largeClass" ng-change="lcSelChange($index)">
              </select>
            </td>
            <td>
              <!-- <select required ng-model="x.smallClass" ng-options="y.smallClassName for y in x.smallClass" ng-change="scSelChange($index)">
              </select> -->
              <select required ng-model="vat.listData[$index].scSel" ng-options="y.smallClassName for y in smallClass" ng-change="scSelChange($index)">
              </select>
            </td>
            <td><input type="text" name="commodityType" ng-model="x.commodityType"></td>
            <td ><input type="text" name="unit" ng-model="x.unit"></td>
            <td><input type="number" name="commodityAmount" value="" ng-model="x.commodityAmount" ng-change="caluator($index)"/></td>
            <td><input type="number" name="price" value="" ng-model="x.price" ng-change="caluator($index)"/></td>
            <td><input type="number" name="allPrice" value="" ng-model="x.allPrice" ng-change="caluator($index)"/></td>
            <td><input type="number" name="taxRate" value="" step="0.01" ng-model="x.taxRate" ng-change="caluator($index)"/></td>
            <td><input type="number" name="vatMoney" value="" ng-model="x.vatMoney" ng-change="caluator()"/></td>
          </tr>
          <tr>
            <td colspan="2">
              合计
            </td>
            <td></td><td></td><td></td><td></td><td></td><td></td>
            <td>
              <input type="number" ng-model="vat.price"/>
            </td>
            <td></td>
            <td>
              <input type="number" ng-model="vat.vatMoney"/>
            </td>
          </tr>
          <tr>
            <td colspan="2">价税合计</td>
            <td colspan="9"><input type="number" ng-model="vat.allPrice" name="name" value=""></td>
          </tr>
          <tr>
            <td rowspan="4">销售方</td>
            <td>名称：</td>
            <td colspan="6">
              <div>
                <div style="width:55%;float:left">
                  <input type="text" ng-model="vat.inCompany.companyName"  placeholder="填写销售方名称" required name="in.companyName">
                </div>
                <div style="width:30%;float:left">
                  <select style="padding:0px 12px" ng-model="selectOut" autocomplete="off">
                    <option value="" disabled="true" selected="selected">选择已有销售方信息</option>
                    <option ng-repeat="x in providers" value="{{x.companyId}}">{{x.companyName}}</option>
                    <option value="clear">清除选择</option>
                  </select>
                </div>
                <div class="clear"></div>
            </td>
            <td rowspan="4">备注</td>
            <td rowspan="4" colspan="2">
              <input style="height:144px;" type="text" name="remarks" ng-model="vat.remarks"  placeholder="填写备注信息">
            </td>
          </tr>
          <tr>
            <td>纳税人识别号：</td>
            <td colspan="6">
              <input type="text" ng-model="vat.inCompany.companyNumber" name="out.companyNumber" value="" placeholder="填写购买方纳税人识别号"></td>
          </tr>
          <tr>
            <td>地址、电话：</td>
            <td colspan="3">
              <input placeholder="填写销售方地址" ng-model="vat.inCompany.companyAddress"  type="text" name="out.companyAddress" value="">
            </td>
            <td colspan="3">
              <input placeholder="填写销售方电话" type="text" ng-model="vat.inCompany.companyPhone" name="out.companyPhone" value="">
            </td>
          </tr>
          <tr>
            <td>开户行及账号</td>
            <td colspan="3">
              <input placeholder="填写银行账号"type="text" ng-model="vat.inCompany.companyAccount" name="out.companyAccount" value="">
            </td>
            <td colspan="3">
              <input placeholder="填写开户银行" type="text" ng-model="vat.inCompany.bank" name="out.companyBank" value="">
            </td>
          </tr>
        </tbody>
        <tfoot style="background-color:#f6f6f6;">
          <tr>
            <td colspan="4"><input type="text"   style="background: #f5f5f5;" placeholder="填写收款人姓名" required ng-model="vat.receiverUser"></td>
            <td colspan="4"><input type="text" style="background: #f5f5f5;"  placeholder="填写复核人姓名" required ng-model="vat.checkUser"></td>
            <td colspan="3"><input type="text"  style="background: #f5f5f5;" placeholder="填写开票人姓名" required ng-model="vat.vatUser"></td>
          </tr>
          <tr>
            <td colspan="2">
              上传发票图片
            </td>
            <td colspan="9">
                <div style="float:left;width:70%;">
                  <input type="file" id="photoFile" name="file" accept="image/jpeg,jpg,png" />
                  <p style="color:red">先上传发票图片以获取图片URL，再点击提交按钮</p>
                </div>
                <div style="float:left;width:30%">
                  <button type="button" required ng-disabled="importPhotoBtn" ng-click="addPhoto()" class="btn btn-default">上传图片</button>
                </div>
            </td>
          </tr>
          <tr>
            <td colspan="2">选择发票类型</td>
            <td colspan="5">
              <select ng-model="vat.type" required>
                <option value="0">进项</option>
                <option value="1">销项</option>
              </select>
            </td>
            <td colspan="4">
              <input style="width:45%" type="submit" class="btn btn-blue" value="提交"/>
              <input style="width:45%;float:right;" type="reset" id="resBtn" class="btn btn-danger" value="重置">
            </td>
          </tr>
        </tfoot>
    </table>
    </form>
  </div>
  <!-- //批量导入数据 -->
  <div id="importModel" ng-if="importModel" class="col-lg-4 col-sm-4 col-xs-12">
      <div class="widget">
          <div class="widget-header">
              <span class="widget-caption">通过 Excel表格 批量导入发票记录</span>
              <span class="icon-right closeImport" ng-click="importData()">
                <i style="line-height:35px;padding-right:10px" class="glyphicon glyphicon-remove"></i>
              </span>
          </div>
          <div class="widget-body bordered-top bordered-palegreen">
              <div class="collapse in">
                  <form role="form" id="excleform" method="post" ng-submit="sureImport()">
                      <div style="margin-top:12px" class="form-group">
                          选择发票数据excel文件
                          <span class="input-icon inverted">
                              <input required style="height:38px" type="file" class="form-control" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" name="commodityfile">
                              <i style="line-height:38px" class="glyphicon glyphicon-search bg-green"></i>
                          </span>
                      </div>
                      <div style="margin-top:12px" class="form-group">
                        选择进销清单excel文件
                          <span class="input-icon inverted">
                              <input required style="height:38px" type="file" class="form-control" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" name="listfile">
                              <i style="line-height:38px" class="glyphicon glyphicon-search bg-green"></i>
                          </span>
                      </div>
                      <div style="text-align:right" class="form-group">
                          <button  ng-disabled="importBtn" class="btn btn-success">确认上传</button>
                      </div>
                  </form>
              </div>
          </div>
      </div>
  </div>
  <div class="mask" ng-if="importModel"></div>
</div>
<script>
$(function() {
  $('.date-picker').datepicker();
});
</script>
